var ordertestform2 = (function () {
    var viewModel = null;
    var run = function () {
        //init control
        {
            $('#order-form-test2 .right-panel .tabs').tabs();

            $('#btnAdd').button({
                icons: {
                    primary: "ui-icon-plusthick"
                },
                text: false
            });

            $('#btnRefresh').button({
                icons: {
                    primary: "ui-icon-refresh"
                },
                text: false
            });
        }

        //init treeview
        {
            $("#tree").dynatree({
                initAjax: { url: "api/rules/get" },
                classNames: {
                    nodeIcon: ''
                },
                onActivate: function (node) {
                    logger.warning("You selected node '" + node.data.title + "'");
                }
            });

            $('#tab-line-items .order-tree').dynatree({
                children: {
                    title: 'Keyline',
                    children: [{ title: 'this is dummy data' }]
                },
                classNames: {
                    nodeIcon: ''
                }
            });
        }
        
        var data = {
            LineItems: repository.lineitem.getAll()
        };
        viewModel = new GridViewViewModel(data);
        ko.applyBindings(viewModel, $('#gridView')[0]);
    };

    return {
        run: run,
        viewModel : viewModel
    };
})();